﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bzure.Common.Core;
using System.ComponentModel.Composition;
using Bzure.Security;
using Bzure.Security.Permissions;

namespace Bzure.Apps.Security
{
    [Export(typeof(IContractFounder)), ExportMetadata("ProviderName", "SecurityAppFounder")]
    public class ContractFounder : ContractFounderBase
    {
        [Import(typeof(IContractFactory<IAccountContract>))]
        IContractFactory<IAccountContract> _accountProvider;
        [Import(typeof(IContractFactory<IUserContract>))]
        IContractFactory<IUserContract> _userProvider;
        [Import(typeof(IContractFactory<IUserGroupContract>))]
        IContractFactory<IUserGroupContract> _userGroupProvider;
        [Import(typeof(IContractFactory<IRoleContract>))]
        IContractFactory<IRoleContract> _roleProvider;

        public override void PluginContract(Dictionary<Type, object> MEFPool)
        {
            MEFPool[typeof(IContractFactory<IAccountContract>)] = this._accountProvider;
            MEFPool[typeof(IContractFactory<IUserContract>)] = this._userProvider;
            MEFPool[typeof(IContractFactory<IUserGroupContract>)] = this._userGroupProvider;
            MEFPool[typeof(IContractFactory<IRoleContract>)] = this._roleProvider;
        }
        public override void PluginManyContract(Dictionary<Type, Dictionary<string, object>> MEFManyPool)
        {
        }
    }
}
